package com.yichat.micro.msghttpservice.config;

import com.yichat.micro.msghttpservice.core.metrics.RequestExecutorMonitor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * Created by chenmohan on 2019/04/28
 *
 * @description
 */
@Slf4j
@Component
@Order(1)
public class AfterStartConfig implements ApplicationRunner {

    @Autowired
    RequestExecutorMonitor requestExecutorMonitor;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        long appStartTime = new Date().getTime();
        log.info("【STARTING】:: appStartTime is {}", appStartTime);
        requestExecutorMonitor.setAppStartTime(appStartTime);
    }
}
